<template>
  <div class="body">
    <div class="container">
      <aside class="sidebar">
        <h3><img src="../assets/image.png" />米话呼叫中心</h3>
        <div class="head"></div>
        <ul>
          <li @click="fn(1)">
            <a :class="{ active:index==1 }"
              ><i class="el-icon-house"></i>&emsp;首页</a
            >
          </li>
          <li @click="fn(2)">
            <a :class="{ active: index==2 }"
              ><i class="el-icon-office-building"></i>&emsp;企业管理</a
            >
          </li>
          <li @click="fn(3)">
            <a :class="{ active: index==3 }"
              ><i class="el-icon-set-up"></i>&emsp;权限管理</a
            >
          </li>
        </ul>
      </aside>
      <nav>
        <router-view></router-view>
      </nav>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      index:1,
      num: 1,
    };
  },
  mounted() {},
  methods: {
    fn(num) {
      if (num == 1 && this.num != 1) {
        this.one = true;
        this.two = false;
        this.three = false;
        this.num = 1;
        this.index=1
        this.$router.push("/home/state");
      } else if (num == 2 && this.num != 2) {
        this.two = true;
        this.one = false;
        this.three = false;
        this.num = 2;
        this.index=2
        this.$router.push("/home/business");
      } else if (num == 3 && this.num != 3) {
        this.three = true;
        this.one = false;
        this.two = false;
        this.num = 3;
        this.index=3
        this.$router.push("/home/permission");
      }
    },
  },
};
</script>
<style lang='less' scoped>
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Microsoft YaHei", Arial, sans-serif;
}

.body {
  background-color: #f5f7fa;
  height: 870px;
  color: #333;
  line-height: 1.6;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  height: 100%;
  padding: 20px;
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 20px;
}

.header {
  grid-column: 1 / -1;
  background-color: #2c3e50;
  color: white;
  padding: 15px 20px;
  border-radius: 4px;
}

.header h1 {
  font-size: 24px;
}

.sidebar {
  background-color: #1a233c;
  height: 100%;
  position: fixed;
  left: 0;
  border-radius: 4px;
  padding: 15px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.sidebar h3 {
  margin: -15px;
  padding: 10px;
  background-color: #000000;
  height: 80px;
  color: #ffffff;
  line-height: 40px;
  margin-bottom: 20px;
  img {
    height: 40px;
    position: relative;
    top: 10px;
  }
}

nav{
  position: fixed;
  left: 180px;
}

.sidebar ul {
  list-style: none;
}

.sidebar li {
  margin-bottom: 10px;
}

.sidebar li a {
  color: #ffffff;
  text-decoration: none;
  display: block;
  padding: 8px 5px;
  border-radius: 4px;
}

.sidebar li a:hover {
  background-color: #203555;
  color: #0e78ce;
}

.active {
  background-color: #203555;
  color: #00ff73;
}

.main-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.data-categories {
  display: flex;
  gap: 15px;
  margin-bottom: 15px;
}

.data-category {
  background-color: white;
  padding: 10px 15px;
  border-radius: 4px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  cursor: pointer;
}

.data-category.active {
  background-color: #3498db;
  // color: white;
}

.overview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.overview-header h3 {
  font-size: 16px;
}

.overview-header a {
  color: #3498db;
  text-decoration: none;
}
</style>